<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function method1(){
            console.log("方法1")
        }

        let method2=function(){}

        let method3=(a,b)=>{
            console.log(a+b)
        }
        method3(2,4)

        method4=x=>console.log(x)

        method4(5)

        
   let person={
     id:1,
     perName:'JACK',
     sayHello:function(){ //普通函数
         console.log(this);//本层
         
          console.log(this.id,this.perName);//本层下的
     },
     sayHi:()=>{
        console.log(this);//window
        console.log("箭头函数："+this.id,this.perName);//window
     }
   }

   person.sayHello();
   person.sayHi();



    </script>
</body>
</html>